home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / setvariable.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  1.1 KB  |  50 lines

  1. <!--- This example shows SetVariable --->
  2.  
  3. <HTML>
  4.  
  5. <HEAD>
  6. <TITLE>
  7. SetVariable Example
  8. </TITLE>
  9. </HEAD>
  10.  
  11. <BASEFONT FACE="Arial, Helvetica" SIZE=2>
  12. <BODY  bgcolor="#FFFFD5">
  13.  
  14. <H3>SetVariable Example</H3>
  15. <P>This file has been disabled for online viewing. Please use your copy of ColdFusion to view this example. 
  16. <!--- 
  17. <CFIF IsDefined("form.myVariable")>
  18.  
  19. <!--- strip out url, client., cgi., session., caller. --->
  20. <!--- This example only lets you set form variables --->
  21.  
  22. <CFSET myName = ReplaceList(form.myVariable, "url,client,cgi,session,caller", "form,form,form,form,form")>
  23.  
  24.  
  25. <CFSET temp = SetVariable(myName, form.myValue)>
  26.  
  27. <CFSET varName = myName>
  28. <CFSET varNameValue = Evaluate(myName)>
  29.  
  30. <CFOUTPUT>
  31.     <P>Your variable, #varName#
  32.     <P>The value of #varName# is #varNameValue#
  33. </CFOUTPUT>
  34.  
  35. </CFIF>
  36.  
  37. <FORM ACTION="setvariable.cfm" METHOD="POST">
  38. <P>Your variable name to set:
  39. <BR><INPUT TYPE="Text" NAME="myVariable" VALUE="form.something">
  40. <P>The value to set it to:
  41. <BR><INPUT TYPE="Text" NAME="myValue" VALUE="Test">
  42.  
  43. <INPUT TYPE="Submit" NAME="show me the result">
  44. </FORM>
  45.  
  46.  --->
  47. </BODY>
  48.  
  49. </HTML>       
  50.